﻿using Red.EngineData.Protocol.Interop;

namespace Red.EngineData.View
{
    /// <summary>
    /// Factory of data views. Used for getting access to engine interop objects.
    /// </summary>
    public class DataViewFactory
    {
        /// <summary>
        /// A way to communicate with engine.
        /// </summary>
        private InteropProtocol _protocol;

        /// <summary>
        /// Requires action scheduler and protocol to communicate with engine.
        /// </summary>
        public DataViewFactory( InteropProtocol protocol )
        {
            _protocol = protocol;
        }

        /// <summary>
        /// Creates engine object view for root
        /// </summary>
        public DataView CreateRoot()
        {
            return new DataView( _protocol, this );
        }

        /// <summary>
        /// Creates engine object view based on given path.
        /// </summary>
        public DataView CreateView( string path )
        {
            return new DataView( path, _protocol, this );
        }

        /// <summary>
        /// Creates notifier based on notifier id.
        /// </summary>
        public Notifier CreateNotifier( uint notifierId )
        {
            return Notifier.Make( notifierId, _protocol );
        }
    }
}
